Trò chơi Tic-Tac-Toe, game đánh caro full source code
53.531 lượt xem;
- AudioRpc.cs
- MarcoPolo-Tutorial /
- Demos /
- Photon Unity Networking /
- Assets /
- project /
1 using UnityEngine;
2
3 public class AudioRpc : Photon.MonoBehaviour
4 {
5
6 public AudioClip marco;
7 public AudioClip polo;
8
9 AudioSource m_Source;
10
11 void Awake()
12 {
13 m_Source = GetComponent<AudioSource>();
14 }
15
16 [RPC]
17 void Marco()
18 {
19 if( !this.enabled )
20 {
21 return;
22 }
23
24 Debug.Log( "Marco" );
25
26 m_Source.clip = marco;
27 m_Source.Play();
28 }
29
30 [RPC]
31 void Polo()
32 {
33 if( !this.enabled )
34 {
35 return;
36 }
37
38 Debug.Log( "Polo" );
39
40 m_Source.clip = polo;
41 m_Source.Play();
42 }
43
44 void OnApplicationFocus( bool focus )
45 {
46 this.enabled = focus;
47 }
48 }
2
3 public class AudioRpc : Photon.MonoBehaviour
4 {
5
6 public AudioClip marco;
7 public AudioClip polo;
8
9 AudioSource m_Source;
10
11 void Awake()
12 {
13 m_Source = GetComponent<AudioSource>();
14 }
15
16 [RPC]
17 void Marco()
18 {
19 if( !this.enabled )
20 {
21 return;
22 }
23
24 Debug.Log( "Marco" );
25
26 m_Source.clip = marco;
27 m_Source.Play();
28 }
29
30 [RPC]
31 void Polo()
32 {
33 if( !this.enabled )
34 {
35 return;
36 }
37
38 Debug.Log( "Polo" );
39
40 m_Source.clip = polo;
41 m_Source.Play();
42 }
43
44 void OnApplicationFocus( bool focus )
45 {
46 this.enabled = focus;
47 }
48 }